//
// Created by bobin on 17-8-19.
//

#include "ImageCapture.h"
#include "iostream"

ImageCapture::ImageCapture(QObject *parent)
        :QThread(parent)
        ,terminate_flag(false) {
    }
ImageCapture::~ImageCapture() {
    wait();
}
bool  ImageCapture::open_device(int number) {

    return capture.open(number);
}

void ImageCapture::run()
{
    while(false == terminate_flag) {
        mutex_Mat.lock();
        capture >> ImgBuf;
        emit image_event();
        mutex_Mat.unlock();
    }
}